package net.sunbeta.test.util;

import java.io.IOException;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class ClassPathResourceResolver implements EntityResolver 
{
    public InputSource resolveEntity(String publicId, String fullFilePath) throws SAXException, IOException
    {
        final String classPathLocation = fullFilePath;
        
        Resource resource = new ClassPathResource(classPathLocation);
        
        return new InputSource(resource.getInputStream());

    }
}
